/**
 * Created by sfr on 2017/10/10.
 */
import React from "react";
import {connect} from "dva";
import { createForm } from 'rc-form';
import { routerRedux } from 'dva/router';
import moment from 'moment';
import {ImagePicker, Button, TextareaItem, WhiteSpace, DatePicker, List, Flex  } from "antd-mobile";
import styles from './taskGetOn.less';
const empty = require('is-empty');
const Item = List.Item;
import new1 from '../../../../assets/infor/banner.jpg';

class TaskStart extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
    };
  }
  //==生命周期--页面渲染
  render() {
    const { files } = this.state;
    const { getFieldProps } = this.props.form;
    const data2=this.props.taskManage.data
    console.log(data2,'2222222222222222222444444444444444444')
    return (
      <div className='taskStart' style={{backgroundColor: '#eee'}}>
        <WhiteSpace />
        <WhiteSpace />
        <div className={styles.detailTitle}>{!empty(data2)&&data2[0].task_name}</div>
        <div className={styles.detailContent}>
          {/*这里是任务详情描述，默认显示全部，一行显示不完*/}
          {/*换行显示。这里是任务详情描述，默认显示全部，一*/}
          {/*行显示不完换行显示。这里是任务详情描述，默认显*/}
          {/*示全部，一行显示不完换行显示。这里是任务详情描*/}
          {/*述，默认显示全部，一行显示不完换行显示。*/}
          {!empty(data2)&&data2[0].task_content}
        </div>
        <WhiteSpace />
        <div>
          <List className="my-list">
            <Item extra={!empty(data2[0])&&data2[0].begin_time}>开始时间</Item>
          </List>
          <WhiteSpace />
          <List className="my-list">
            <Item extra={!empty(data2[0])&&data2[0].end_time}>结束时间</Item>
          </List>
        </div>
        <WhiteSpace />
        <Flex justify="between" align="center" className={styles.who}>
          <Flex justify="start" align="center">
            <div style={{width: '0.6rem',height: '0.6rem',marginRight: '0.2rem'}}>
              <img src={new1} alt="" style={{width:'100%',height: '100%'}} />
            </div>
            <div>
              {!empty(data2)&&data2[0].task_author} 发布了任务
            </div>
          </Flex>
          <div>
            {!empty(data2)&&data2[0].create_time}
          </div>
        </Flex>
        <WhiteSpace />
        <WhiteSpace />
        <WhiteSpace />
        <WhiteSpace />
        <WhiteSpace />
        <WhiteSpace />
        <div className={styles.addBtn}>
          <Button >完成</Button>
        </div>
        <div className={styles.addBtn}>
          <Button >未完成</Button>
        </div>
        <WhiteSpace />
        <WhiteSpace />
      </div>
    );
	}
  //==组件所有函数
  //上传图片
  onChange = (files, type, index) => {
    console.log(files, type, index);
    this.setState({
      files,
    });
  }
}

function mapStateToProps({ infor,taskManage }){
  return {
    infor,
    taskManage
	};
}

const Wrapper = createForm()(TaskStart);

export default connect(mapStateToProps)(Wrapper);
